{{!
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
}}
<div class="well">
  <div class="form-group">
    <label for="" class="control-label col-xs-2">Name<span class="requiredField">&nbsp;*</span></label>
    <div class="col-xs-7">
      {{input type="text" class="form-control" name="dataset-name" value=dataset.name placeholder="Dataset Name"}}
      {{field-error model=this field='dataset.name' showErrorMessage=showErrorMessage}}
    </div>
  </div>
  <div class="form-group">
    <label for="" class="control-label col-xs-2">URI Template<span class="requiredField">&nbsp;*</span></label>
    <div class="col-xs-7">
      {{input type="text" class="form-control" name="uri-template" value=dataset.uriTemplate placeholder="baseFsURI/${YEAR}/${MONTH}/${DAY}/${HOUR}/${MINUTE}"}}
      {{field-error model=this field='dataset.uriTemplate' showErrorMessage=showErrorMessage}}
    </div>
  </div>
  <div class="form-group">
    <label class="control-label col-xs-2">Frequency<span class="requiredField">&nbsp;*</span></label>
    <div class="col-xs-2">
      <select class="form-control" name="frequency-type" title="Frequency type" onchange={{action (mut dataset.frequency.type) value="target.value"}}>
        {{#each timeUnitOptions as |timeUnit|}}
          <option value={{timeUnit.value}} selected={{eq timeUnit.value dataset.frequency.type}}>{{timeUnit.displayName}}</option>
        {{/each}}
      </select>
      {{#field-error model=this field='dataset.frequency.type' showErrorMessage=showErrorMessage}}{{/field-error}}
    </div>
    <div class="col-xs-3">
      {{input class="form-control" type="text" value=dataset.frequency.value placeholder="frequency" title="Periodic intervals at which datasets that are produced, and coordinator applications are scheduled to run"}}
      {{field-error model=this field='dataset.frequency.value' showErrorMessage=showErrorMessage}}
    </div>
  </div>
  {{#date-with-expr required=true inputName="initialInstance" label="Initial Instance" inputPlaceholder="Initial Instance" dateField=dataset.initialInstance register="registerChild" deregister="deregisterChild"}}{{/date-with-expr}}
  <div class="form-group">
    <label for="" class="control-label col-xs-2">Time Zone<span class="requiredField">&nbsp;*</span></label>
    <div class="col-xs-7">
      <select onchange={{action (mut dataset.timezone) value="target.value"}} name="select-input" class="form-control" data-show-icon="true">
        {{#each timezoneList as |timezone index|}}
        <option value={{timezone.value}} selected={{eq timezone.value dataset.timezone}}>{{timezone.displayName}}</option>
        {{/each}}
      </select>
      {{field-error  model=this field='dataset.timezone' showErrorMessage=showErrorMessage}}
    </div>
  </div>
  <div class="form-group">
  <label for="" class="control-label col-xs-2">Done Flag
    {{#if required}}
      <span class="requiredField">&nbsp;*</span>
    {{/if}}
  </label>
  <div class="col-xs-7">
    <div class="input-group">
      <div class="input-group-btn">
        <button onclick={{action 'clearDoneFlag' 'default'}} type="button" class="btn btn-default {{if (eq dataset.doneFlagType 'default') 'btn-secondary' ''}} scope-btn">
          Default
        </button>
        <button onclick={{action 'clearDoneFlag' 'custom'}} type="button" class="btn btn-default {{if (eq dataset.doneFlagType 'custom') 'btn-secondary' ''}} scope-btn">
          Custom
        </button>
      </div>
      {{input type="text" class="form-control" name="done-flag" value=dataset.doneFlag placeholder='File Name' disabled=(eq dataset.doneFlagType 'default')}}
    </div>
  </div>
</div>
  <div class="form-group">
    <div class="col-xs-7 pull-right">
      <button id="dataset-add-btn" {{action 'cancelDatasetOperation'}} type="button" class="btn btn-default">Cancel</button>
      {{#if createMode}}
      <button id="dataset-add-btn" {{action 'addDataset'}} type="button" class="btn btn-primary">Save</button>
      {{else}}
      <button id="dataset-update-btn" {{action 'updateDataset'}} type="button" class="btn btn-primary"> Update </button>
      {{/if}}
    </div>
  </div>
</div>
